package basic.爬楼梯;

/**
 * @author zhengTao
 * @version 1.0
 * @description: 爬楼梯
 * @date 2022/11/27 16:17
 */
public class Demo70 {
    public int climbStairs(int n) {
        if(n==1){
            return 1;
        }else if(n==2){
            return 2;
        }else {
            int[] res=new int[n];
            res[0]=1;res[1]=2;
            for (int i = 2; i < n; i++) {
                res[i]=res[i-1]+res[i-2];
            }
            return res[n-1];
        }
    }
}
